Repository navigation
[BugFix] Cancel the searches of an async PPL job when it is cancelled - #6012
Merged
ahkcs merged 1 commit intoDec 2, 2026
Merged
Conversation
DELETE /_plugins/_async_query/{id} only marked the query task cancelled. A
scan stops at its next page, but a search already running, such as an
aggregation, ran to the end after the client was told CANCELLED. The
submit's transport task has completed by then, so the task manager no
longer tracks it and cannot cancel its children; cancel them by their
parent task id instead, as _tasks/_cancel?parent_task_id= does.
Resolves opensearch-project#6004
Signed-off-by: Kai Huang <ahkcs@amazon.com>
ahkcs
requested review from
LantaoJin,
RyanL1997,
Swiddis,
acarbonetto,
anirudha,
dai-chen,
joshuali925,
mengweieric,
noCharger,
penghuo,
ps48,
qianheng-aws,
songkant-aws,
vamsimanohar,
ykmr1224 and
yuancu
as code owners
December 1, 2026 19:13
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6012 +/- ##
=========================================
Coverage 89.49% 89.49%
Complexity 12269 12269
=========================================
Files 980 980
Lines 42018 42018
Branches 4836 4836
=========================================
Hits 37604 37604
Misses 2940 2940
Partials 1474 1474
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
angle943
approved these changes
Dec 1, 2026
penghuo
approved these changes
Dec 1, 2026
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #6004.
DELETE /_plugins/_async_query/{id}on a running job returnedCANCELLED, but the job's aggregation search kept running until it finished on its own.Cause: the runner's cancel hook only called
CancellableTask.cancel(), which marks the query task and nothing else.RUNNING, so the task manager no longer tracks it:_tasksshows nocluster:admin/opensearch/ppltask while the job runs. The search still names that task as its parent.Fix: on cancel, mark the task as before, so no new search starts. Then send a
CancelTasksRequestfiltered on that parent task id, the same thing_tasks/_cancel?parent_task_id=does.Verification
A single node with 500k docs. The query
source=demo-logs | where like(message, '%e%') | stats count() by span(@timestamp, 3h)is submitted withwait_for_completion_timeout: 0. Once its search task appears, the job is deleted, and_tasks?actions=indices:data/read/searchis read afterwards:cancelled: falseTransportPPLQueryActionCancellationTest, 2 new tests:opensearch-sql-plugin:test,spotlessCheckAsyncPPLSecurityIT(integTestWithSecurity), which includes deleting a running job through forwardingAsyncPPLMultiNodeRoutingIT(asyncMultiNodeIT)AsyncPPLQueryLifecycleITparity_*flake on main: await=0analysis error returns inline.Related Issues
Resolves #6004
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.